// import { useRouter } from "vue-router";
export default {
  name: 'InfoItem',
  template: '',
  props: {
    list: Array,
    type: Number
  },
  setup (props) {
    // 在setup里面获取参数值
    const typeEnum = {
      info: 1,
      product: 2
    };
    const type = props.type
    const router = VueRouter.useRouter()
    const goDetail = (t, i) => {
      if (t === typeEnum.info) {
        console.log('info', typeEnum.info, i)
        // router.push({ path: '/Info/Detail', query: { index: i } })
        router.push({ name: 'iDetail', params: { index: i } })
      } else {
        console.log('product', typeEnum.product, i)
        router.push({ name: 'pDetail', params: { index: i } })
        // router.push({ path: '/product/Detail', query: { index: i } })
      }
    };
    return {
      type,
      typeEnum,
      goDetail
    }
  }
}